package com.wpml.ware.controller;

import com.wpml.common.util.PageUtils;
import com.wpml.common.util.ResultJson;
import com.wpml.ware.entity.WareOrderTaskModel;
import com.wpml.ware.service.WareOrderTaskService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Arrays;
import java.util.Map;


/**
 * 库存工作单
 *
 * @author leifengyang
 * @email leifengyang@gmail.com
 * @date 2019-10-08 09:59:40
 */
@RestController
@RequestMapping("ware/wareordertask")
public class WareOrderTaskController {
    @Autowired
    private WareOrderTaskService wareOrderTaskService;

    /**
     * 列表
     */
    @GetMapping("/list")
    //@RequiresPermissions("ware:wareordertask:list")
    public ResultJson list(@RequestParam Map<String, Object> params){
        PageUtils page = wareOrderTaskService.queryPage(params);

        return ResultJson.ok(page);
    }


    /**
     * 信息
     */
    @GetMapping("/info/{id}")
    //@RequiresPermissions("ware:wareordertask:info")
    public ResultJson info(@PathVariable("id") Long id){
        WareOrderTaskModel wareOrderTask = wareOrderTaskService.getById(id);

        return ResultJson.ok(wareOrderTask);
    }

    /**
     * 保存
     */
    @PostMapping("/save")
    //@RequiresPermissions("ware:wareordertask:save")
    public ResultJson save(@RequestBody WareOrderTaskModel wareOrderTask){
		wareOrderTaskService.save(wareOrderTask);

        return ResultJson.ok();
    }

    /**
     * 修改
     */
    @PostMapping("/update")
    //@RequiresPermissions("ware:wareordertask:update")
    public ResultJson update(@RequestBody WareOrderTaskModel wareOrderTask){
		wareOrderTaskService.updateById(wareOrderTask);

        return ResultJson.ok();
    }

    /**
     * 删除
     */
    @PostMapping("/delete")
    //@RequiresPermissions("ware:wareordertask:delete")
    public ResultJson delete(@RequestBody Long[] ids){
		wareOrderTaskService.removeByIds(Arrays.asList(ids));

        return ResultJson.ok();
    }

}
